import type { RouteRecordRaw } from 'vue-router'

import login from '@/views/login/index.vue'
import admin from '@/views/admin/index.vue'

//自动导入路由文件
const files=import.meta.glob('./routes/*.ts',{eager:true})
const children=[] as RouteRecordRaw[]
for(let key in files){
    let value=(files[key as keyof typeof files]as any).default
    if(Array.isArray(value)){
        children.push(...value)
    }else{
        children.push(value)
    }
}

export default [
{ 
    path: '/login', 
    name:'login',
    component:login,
    meta:{
        nologin:true
    }
},
{
    path:'/',
    name:'admin',
    component:admin,
    redirect:'/dashoard',
    children
}
] as RouteRecordRaw[]